#include"process.h"

#define POINT '.'
#define SPACE ' '

void process(double total,double current)
{
  //当前进度
  char bar[NUM];
  double rate = (current / total) * 100; 

  memset(bar,'\0',sizeof(bar));
  for(int i = 0; i < (int)rate; i++)
  {
    bar[i] = STYLE;
  }
  
  char points[4];
  memset(points,'\0',sizeof(points));
  static int num = 0;
  num++;
  num %= 3;
  for(int i = 0; i < 3; i++ )
  {
    if(i <= num)
    {
      points[i] = POINT;
    }
    else 
    {
      points[i] = SPACE;
    }

  }
  
  printf("[%-100s][%1lf%%]%s\r",bar,rate,points);
  fflush(stdout);
  sleep(1);
}

